{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "colab": {
      "provenance": []
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3"
    },
    "language_info": {
      "name": "python"
    }
  },
  "cells": [
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "wDEp8XLyTVMl"
      },
      "outputs": [],
      "source": [
        "try:\n",
        "    import evidently\n",
        "except:\n",
        "    !pip install git+https://github.com/evidentlyai/evidently.git"
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "import pandas as pd\n",
        "import numpy as np\n",
        "\n",
        "from sklearn import datasets\n",
        "\n",
        "from evidently import ColumnMapping\n",
        "from evidently.report import Report\n",
        "\n",
        "from evidently.metrics import ColumnDriftMetric, ColumnValuePlot, Comment"
      ],
      "metadata": {
        "id": "wAK2ki_SULhx"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "adult_data = datasets.fetch_openml(name='adult', version=2, as_frame='auto')\n",
        "adult = adult_data.frame\n",
        "\n",
        "adult_ref = adult[~adult.education.isin(['Some-college', 'HS-grad', 'Bachelors'])]\n",
        "adult_cur = adult[adult.education.isin(['Some-college', 'HS-grad', 'Bachelors'])]"
      ],
      "metadata": {
        "id": "gEFdC8pxUcwX"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "text_example = \"\"\"\n",
        "  # Header H1\n",
        "  Important paragraph!\n",
        "\n",
        "  ## Header H2\n",
        "  - point 1\n",
        "  - point 2\n",
        "  - point 3\n",
        "\"\"\""
      ],
      "metadata": {
        "id": "eq7gbQnvU0iq"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "report = Report(metrics=[\n",
        "    ColumnDriftMetric('age'),\n",
        "    Comment(text_example),\n",
        "    ColumnValuePlot('age'),  \n",
        "])\n",
        "\n",
        "report.run(reference_data=adult_ref, current_data=adult_cur)\n",
        "report"
      ],
      "metadata": {
        "id": "G5rYds0rUeCw"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [],
      "metadata": {
        "id": "uwSbgPnUU5vb"
      },
      "execution_count": null,
      "outputs": []
    }
  ]
}